package com.xiaoKe.zhonghzu.global.view;
import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.xiaoKe.zhonghzu.R;

/**
 * @ProjectName : xiaoke-pad-zhongzhu
 * @Author : Shijingna
 * @Time : 2024/7/19 15:12
 * @Description : 标题的封装
 */
public class ViewTitle extends RelativeLayout {
    public ViewTitle(Context context) {
        super(context);
    }

    public ViewTitle(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ViewTitle(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    private TextView titleName,titleNexName;
    private ImageView ivBackLeft;
    private LinearLayout LinearLayoutTitleName;

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        titleName = findViewById(R.id.titleName);
        titleNexName = findViewById(R.id.titleNexName);
        ivBackLeft = findViewById(R.id.ivBackLeft);
        LinearLayoutTitleName = findViewById(R.id.LinearLayoutTitleName);
        LinearLayoutTitleName.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {

            }
        });
    }
    String name;
    String nexName;
    Activity tBaseActivity;
    boolean aBoolean;//是否显示切换按钮
    public void initTitle(String name, Activity tBaseActivity) {
        this.name = name;
        this.tBaseActivity = tBaseActivity;
        intoData();
    }
    public  void initTitle(String name,String nexName, Activity tBaseActivity) {
        this.name = name;
        this.nexName = nexName;
        this.tBaseActivity = tBaseActivity;
        intoData();
    }
    public void initTitle(String name,String nexName,boolean aBoolean, Activity tBaseActivity) {
        this.aBoolean = aBoolean;
        this.name = name;
        this.nexName = nexName;
        this.tBaseActivity = tBaseActivity;
        intoData();
    }

    public void intoData(){
        titleName.setText(name);
        titleNexName.setText(nexName);
        ivBackLeft.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tBaseActivity.finish();
            }
        });
    }
}
